class MyCircularDeque {
	private arr: number[];
	private maxSize: number;

	constructor(k: number) {
		this.maxSize = k;
		this.arr = [];
	}

	insertFront(value: number): boolean {
		if (this.isFull()) {
			return false;
		}

		this.arr.unshift(value);
		return true;
	}

	insertLast(value: number): boolean {
		if (this.isFull()) {
			return false;
		}

		this.arr.push(value);
		return true;
	}

	deleteFront(): boolean {
		if (this.isEmpty()) {
			return false;
		}

		this.arr.shift();
		return true;
	}

	deleteLast(): boolean {
		if (this.isEmpty()) {
			return false;
		}

		this.arr.pop();
		return true;
	}

	getFront(): number {
		if (!this.arr.length) {
			return -1;
		}

		return this.arr[0];
	}

	getRear(): number {
		if (!this.arr.length) {
			return -1;
		}

		return this.arr[this.arr.length - 1];
	}

	isEmpty(): boolean {
		return this.arr.length === 0;
	}

	isFull(): boolean {
		return this.arr.length === this.maxSize;
	}
}
